package listeners;

import java.sql.SQLException;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import dataBase.DBInitializer;

/**
 * Application Lifecycle Listener implementation class OnApplicationLoadListenner
 *
 */
public class OnApplicationLoadListenner implements ServletContextListener {

    /**
     * Default constructor. 
     * @throws Exception - from initiating DB 
     */
    public OnApplicationLoadListenner() throws Exception {
		try {
			DBInitializer.getInstance().initDB();
		} catch (Exception e) {
			System.err.println("couldn't initiate DB");
			throw e;
		}
    }

	/**
     * @see ServletContextListener#contextInitialized(ServletContextEvent)
     */
    public void contextInitialized(ServletContextEvent arg0) {
        // TODO Auto-generated method stub
    }

	/**
     * @see ServletContextListener#contextDestroyed(ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0) {
        // TODO Auto-generated method stub
    }
	
}
